using WL.Think.Abp.Entities;

namespace WL.Think.Abp.Repositories;

public interface IBaseCategoryRepository<TCategory,TKey> : IEfCoreKeyRepository<TCategory, TKey> 
    where TCategory : BaseCategory<TCategory, TKey> 
    where TKey: struct, IComparable<TKey>
{
    /// <summary>
    /// 获取目录树
    /// </summary>
    /// <param name="parentId"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public Task<List<TCategory>> GetTreeAsync(TKey? parentId, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取启用的目录树
    /// </summary>
    /// <param name="parentId"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public Task<List<TCategory>> GetActiveTreeAsync(TKey? parentId, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取当前目录下最大的序号
    /// </summary>
    /// <param name="parentId"></param>
    /// <returns></returns>
    public Task<int> GetMaxIndexAsync(TKey parentId);
}

public interface IBaseCategoryRepository<TCategory> : IBaseCategoryRepository<TCategory, Guid>
    where TCategory : BaseCategory<TCategory,Guid>
{
}